#@layout()
#define main()

<script type="text/javascript">
	var isExport = false;

	//改变提交标志位
	var changeBooleanExport = function(submitObj){
		//console.log($(submitObj).attr("value"));
		var submitType = $(submitObj).attr("value");
		if(submitType == '导出'){
			isExport = true;
		}else{
			isExport = false;
		}
	}

	//根据 提交的按钮 改变 提交 URL
	var changeUrl = function(formObj){
		console.log($(formObj).attr("action"));
		var ctxPath = $(formObj).attr("action");
		if(isExport){
			$(formObj).attr("action",ctxPath+"/task/download")
		}else{
			$(formObj).attr("action",ctxPath+"/task/index")
		}

		return true;
	}
	//显示一条记录的详细情况
	var openDetail = function(id){
		$( "#dialog_"+id ).dialog();
	}

	$(function() {
		//$( "#dialog" ).dialog();
		//document.getElementById('taskFormId').submit(); 导致循环调用
	});
</script>
<h1>
	<form action="#(ctx??)" method="get">
		<fieldset class="solid">
			<legend>菜单</legend>
			<span>
				<label>已完成:</label>
				<select name="complete">
					<option value="">全部</option>
					#if(complete != null && complete)
					<option value="true" selected>是</option>
					<option value="false">否</option>
					#else
					<option value="true">是</option>
					<option value="false" selected>否</option>
					#end
				</select>
			</span>

			<span>
				<label>起始时间:</label>
				<input type="date" name="startTime" value="#(startTime)" />
			</span>
			<span>
				<label>结束时间:</label>
				<input type="date" name="endTime" value="#(endTime)" />
			</span>
			<span>
				<label></label>
				<input value="查询" type="submit" onclick="changeBooleanExport(this)">
			</span>
		</fieldset>
	</form>
</h1>
<div class="table_box">
	<table class="list">
		<thead>
			<tr>
				<th>任务责任人</th>
				<th>任务执行数</th>
				<th>id</th>
				<th>任务名称</th>
				<th>项目名称</th>
				<th>任务责任人</th>
				<th>是否重要</th>
				<th>是否紧急</th>
				<th>权重</th>
				<th>分类</th>
				<th>计划完成时间</th>
				<th>开始时间</th>
				<th>持续天数</th>
				<th>备注</th>
			</tr>
		</thead>
		<tbody>
			#for(x : list)
			#for(subX : x.tasks)
			<tr>

					<td style="text-align:left;">#(x.userName)</td>
					<td style="text-align:left;">#(x.taskDoingCount)</td>

					<td style="text-align:left;">#(subX.id)</td>
					<td style="text-align:left;" title="#(subX.title)">#(subX.title)</td>
					<td style="text-align:left;" title="#(subX.projectName)">#(subX.projectName)</td>
					<td style="text-align:left;" title="#(subX.userName)">#(subX.userName)</td>

					#if(subX.important)
					<td style="text-align:left;">重要</td>
					#else
					<td style="text-align:left;">不重要</td>
					#end
					#if(subX.emergency)
					<td style="text-align:left;">紧急</td>
					#else
					<td style="text-align:left;">不紧急</td>
					#end
					<td style="text-align:left;" title="#(subX.weight)">#(subX.weight)</td>
					<td style="text-align:left;" title="#(subX.category)">#(subX.category)</td>
					<td style="text-align:left;">#date(subX.reportDate,"yyyy年MM月dd日")</td>
					<td style="text-align:left;">#date(subX.startTime,"yyyy年MM月dd日")</td>
					<td style="text-align:left;">#(subX.duringTime)</td>
					#if(subX.summary !=null && subX.summary.length() > 6)
					<td style="text-align:left;" title="#(subX.summary)">#(subX.summary.substring(0,5))...</td>
					#else
					<td style="text-align:left;" title="#(subX.summary)">#(subX.summary)</td>
					#end
			</tr>
			#end
			#end
			<tr></tr>
			<tr></tr>
		</tbody>
	</table>
</div>
#end